CFLAGS=-O2 -Wall -I ../include/ -lm
QUIET=@
SNAME:=$(shell uname)
ifeq ($(strip $(SNAME)),Linux)
EXTRALIB=-lrt -levent
endif
SRC:= $(shell find . -name "[a-zA-Z]*.c" -print0 | xargs -0)
OBJECTS= $(subst .c,.o,$(SRC))
.PHONY: clean
all: $(MODULE)

%.o: %.c
	@echo "> $@ <"
	$(QUIET) gcc -c $(CFLAGS) $^
	
$(MODULE): $(OBJECTS)
	@echo "+ $@ +"

	$(QUIET) gcc -o $@ $(CFLAGS) $^ $(EXTRALIB)


clean:
	@echo "Cleaning $(MODULE)"
	$(QUIET) rm -rf $(OBJECTS) $(MODULE)
